{% extends "./admin/layout.html" %}
{% block title %}栏目管理{% endblock %}
{% block head %}
    {{ super() }}
{% endblock %}
{% block content %}
    <div class="row" style="margin: 100px 200px 0px 200px;">
        <div class="col-md-5">
            {% block nav %}
                {{ super() }}
            {% endblock %}
        </div>
        <div class="col-md-7">
            <div class="example">

                <form action="./add/" method="post">
                    栏目分类：
                    <select name="fid">
                        <option value="0">顶级栏目</option>
                        {% for i in data.column %}
                            {% if i.fid == 0 %}
                                <option value="{{ i.id }}">
                                    {{ i.title }}
                                </option>
                                {% for n in data.column %}
                                    {% if n.fid == i.id %}
                                        <option value="{{ i.id }}">
                                            -----{{ n.title }}
                                        </option>
                                    {% endif %}
                                {% endfor %}

                            {% endif %}
                        {% endfor %}
                    </select>
                    分类名:<input type="text" name="title">
                    <button>添加</button>
                </form>
                <hr>

                <table class="table">
                    <thead>
                    <tr>
                        <th>栏目名称</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>

                    {% for i in data.column %}
                        {% if i.fid == 0 %}
                            <tr>
                                <th>{{ i.title }}</th>
                                <th><a href="./del/{{ i.id }}/">删除</a></th>
                            </tr>
                            {% for n in data.column %}
                                {% if n.fid == i.id %}
                                    <tr>
                                        <th>---{{ n.title }}</th>
                                        <th><a href="./del/{{ n.id }}/">删除</a></th>
                                    </tr>
                                {% endif %}
                            {% endfor %}

                        {% endif %}
                    {% endfor %}
                    </tbody>
                </table>
            </div>
        </div>
    </div>
{% endblock %}